package com.cardetective.shopcar.network.api

import com.android.base_network.data.BaseResponse
import com.cardetective.shopcar.network.model.AddressInfoModel
import com.cardetective.shopcar.network.model.AddressListModel
import kotlinx.coroutines.flow.Flow
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

/**
 * 商品相关
 * */
interface AddressApi {

    // 获取分类
    @GET("/v3/member/getDefaultAddress")
    fun getDefaultAddress(): Flow<BaseResponse<AddressInfoModel>>

    // 添加地址
    @FormUrlEncoded
    @POST("/v3/member/addAddress")
    fun addAddress(
        @Field("firstName") firstName: String,
        @Field("surName") surName: String,
        @Field("mobile") mobile: String,
        @Field("detail") detail: String,
        @Field("isDefault") isDefault: Boolean,
    ): Flow<BaseResponse<String>>

    // 获取默认地址
    @GET("/v3/member/getAddressByPage")
    fun getAddressList(
        @Query("pageNumber") pageNumber: Int,
        @Query("pageSize") pageSize: Int,
    ): Flow<BaseResponse<AddressListModel>>

    // 删除地址
    @FormUrlEncoded
    @POST("/v3/member/deleteAddress")
    fun deleteAddress(
        @Field("id") id: String
    ): Flow<BaseResponse<String>>

     // 更新地址地址
    @FormUrlEncoded
    @POST("/v3/member/updateAddress")
    fun updateAddress(
        @Field("id") id: String,
        @Field("isDefault") isDefault: Boolean
    ): Flow<BaseResponse<String>>





}